Skip to content

Do not install playwright in CI #12607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 8, 2025
Merged

Do not install playwright in CI #12607

merged 4 commits into from
May 8, 2025

Conversation

jjspace
Copy link
Contributor

@jjspace jjspace commented May 7, 2025

Description

When testing CI build support for #12574 I was running the CI builds a lot. I took a brief look into ways to speed up CI and realized we install all the playwright dependencies for every CI job even though none of them currently do anything with CI. On average the npm install steps seems to take ~1m 20s in most jobs. Without doing the playwright install step this drops to only ~20-30s. Compare the deploy job in main to the deploy job on this branch's commit

Once we decide to move forward with #12355 we can force it to install specifically in the CI workflows it's needed.

As an aside I did spend a little time looking at turning on caching for the npm packages in CI. This seems like it would be really helpful but relies on a "cache key" that defines when to invalidate the cache. They heavily suggest using a package-lock.json file as that will always change with every dependency. However we don't use one so there's a decent chance it will not invalidate the cache when it actually should for version ranges in package.json. If we could find a way to set our own key based on the "wanted" values of npm outdated I think that would be our "ideal" setup. That said the node action currently does not allow setting our own key anyway but there's a PR for it.

On top of that the largest slowdown with the install step from Playwright is downloading the browser binaries and they specifically say that you should not cache these. Even if you did rebuilding them would take as much time as re-downloading.

Issue number and link

No issue

Testing plan

  • Check the CI runs of all jobs on this branch vs any others
  • Run npm install locally and make sure playwright does still install and download browsers locally
  • Test with CI=true npm install to see that running it in CI does not do the playwright install

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

@jjspace jjspace requested a review from ggetz May 7, 2025 18:04
Copy link

github-actions bot commented May 7, 2025

Thank you for the pull request, @jjspace!

✅ We can confirm we have a CLA on file for you.

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, seems like a straightforward approach to a lot of saved time. 👍 from me. Just one comment on the script.

const { env } = process;

const isCI = !!(
env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I do appreciate the robust approach, why did we decide to cover all possible types of CI providers? Just remember that we'd need to maintain this script going forward, and I could see it becoming out of date quickly.

Copy link
Contributor Author

@jjspace jjspace May 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggetz it was simply because the library I was copying from already had them all and it was the same amount of effort (right now) to copy all of them vs copying one. I can remove them if you think it's better for us long term to focus on our use case, can re-add if we ever need to

Copy link
Contributor

@ggetz ggetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good to me! Thanks!

@ggetz ggetz added this pull request to the merge queue May 8, 2025
Merged via the queue into main with commit fb31446 May 8, 2025
5 checks passed
@ggetz ggetz deleted the no-playwright-in-ci branch May 8, 2025 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants